package com.airticketbooking.controller.manager;

import com.airticketbooking.common.domain.PageDTO;
import com.airticketbooking.common.domain.PageQuery;
import com.airticketbooking.common.domain.R;
import com.airticketbooking.common.utils.UserContext;
import com.airticketbooking.dto.OrderDTO;
import com.airticketbooking.po.Order;
import com.airticketbooking.vo.OrderVO;
import com.airticketbooking.service.OrderService;
import com.github.pagehelper.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Mr.J
 * @version 1.0.0
 * @date 2024/11/12
 * @desc
 */

@RequestMapping("/air/manager/order")
@RestController
@Api(tags = "管理端管理用户相关接口")
@RequiredArgsConstructor
@Slf4j
public class ManageOrderController {

	private final OrderService orderService;

	//	根据订单号查询订单信息
	@GetMapping("/getByOrderId/{orderId}")
	public R<OrderVO> getByOrderId(@PathVariable Integer orderId) {

		OrderVO orderVO = orderService.getOrderVOById(orderId);

		return R.ok(orderVO);
	}

	//条件分页查询订单信息
	@GetMapping("/getByStatus")
	@ApiOperation(value = "根据条件查询订单列表")
	public R<List<Order>> getOrderListByStatus(Integer status) {

		OrderDTO orderDTO = new OrderDTO();
		orderDTO.setStatus(status);

		List<Order> orders = orderService.querylist(orderDTO);

		return R.ok(orders);

	}





}
